#include <iostream>
using namespace std;
#define ll long long
#define gua(i,a,b) for(int i=(a);i<=(b);++i)
int t,n,qia;
int ans[9];
ll gg[100005],qr[100005];
int main(){
	cin>>t;
	gua(j,1,t){
		cin>>n>>qia;
		gua(i,0,n-1)cin>>gg[i];
		gua(i,0,n-1){
			int x;cin>>x;
			gg[i]-=x;
			qr[i]=qr[i-1]+gg[i];
		}
		if(qr[n-1]+qia<0)ans[j]=-1;
		else{
			int now=0;
			while(now<n){
				int nn=1;ll tt=gg[now]+qia;
				if(tt>=0){
					while(tt>=0&&nn<n){
						tt+=gg[(now+nn)%n];
						if(tt>=0)++nn;
					}
				}
				if(tt>=0&&nn==n)ans[j]=now+1;
				now+=nn;
			}
		}
	}
	gua(i,1,t)cout<<ans[i]<<endl;
	return 0;
}
